home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.coast.net!torn!nott!cunews!wabakimi!abelo
- From: abelo@chat.carleton.ca (Andrew Belo)
- Newsgroups: comp.lang.c
- Subject: Re: floats in borland C++ 4.5
- Date: 17 Mar 1996 23:31:36 GMT
- Organization: Carleton University, Ottawa, Canada
- Message-ID: <4ii7co$18j@bertrand.ccs.carleton.ca>
- References: <4if2ec$scg@bertrand.ccs.carleton.ca> <827086760snz@genesis.demon.co.uk>
- NNTP-Posting-Host: wabakimi.carleton.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- Lawrence Kirby (fred@genesis.demon.co.uk) wrote:
- > In article <4if2ec$scg@bertrand.ccs.carleton.ca>
- > abelo@chat.carleton.ca "Andrew Belo" writes:
-
- > >
- > >void bubblesort( double *dblarray, int numberOfElements)
- > >
- > >{
- > > int top, search, temp;
- > >
- > > for( top = 0; top < numberOfElements -1; top++)
- > > for(search = top +1; search < numberOfElements; search++)
- > > if(dblarray[search] > dblarray[top])
- > > {
- > > temp = dblarray[search];
- > > dblarray[search] = dblarray[top];
- > > dblarray[top] = temp;
- > > }
- > >}
-
- > Firstly this isn't a bubble sort (e.g. bubble sort always compares and swaps
- > adjacent elements), it is an exchange sort. Do you have any reason not to
- > use the standard library qsort() function - it is likely to be much more
- > efficient.
-
- It is for an assignment! I know that it isn't a true bubble sort we were
- told to use this algorithm and to name the function this.
-
- I have however found that if I go to the target expert and make it a
- floating point program it works fine!
-
- *******
- *********** Andrew Belo
- ************* Carleton University
- *************** abelo@chat.carleton.ca
- *************
- ***********
- | |
- 9| 0 0 |P
- | @ |
- | Q --|----Afros in the house
- \_mmmmm_/
- mmm
-